package com.yl.chainStore.pojo.vo.pay

import com.baomidou.mybatisplus.annotation.TableField
import com.yl.chainStore.common.Constants
import java.math.BigDecimal
import java.math.RoundingMode

data class RefundByDetailVo(
	val detailId:Long,
	val count : Int,

	//实际退款金额
	var refundMoney:Long
){
	/**
	 * 退款金额显示
	 */
	@TableField(exist = false)
	var refundMoneyShow: BigDecimal? = null
		get() {

			if (field == null) {
				return BigDecimal(refundMoney.div(Constants.OtherConfig.MONEY_TO_DB_DOUBLE)).setScale(
					2,
					RoundingMode.HALF_UP
				)
			}
			return field
		}
		set(value) {
			if (value != null) {
				refundMoney = (value.multiply(BigDecimal(Constants.OtherConfig.MONEY_TO_DB_DOUBLE))).toLong()
				field = value
			}
		}
}
